<?php
/**
 * Created by PhpStorm.
 * User: giozola
 * Date: 2018/10/19
 * Time: 9:57
 */

namespace addons\hlapp\controller;


use addons\hlapp\model\HlappEvaluateSendLogs;
use addons\hlapp\model\HlappProject;
use addons\hlapp\model\HlappProjectEvaluate;

class Wrong extends Common {
    /**
     * 超期项目
     */
    public function projectOutOfDate(){
        // 超期项目
        $overdueProjects = (new HlappProject())->getOutOfDateProject();
        $this->assign("overdueProjects",$overdueProjects);
        $this->fetch();
    }

    /**
     *  评价警告,
     */
    public function evaluateWrong(){
        //本周
        $now  = time();
        $evaluateWrongs = (new HlappProjectEvaluate())->noEvaluate($this->getWeekStartTime($now));
        $this->assign('evaluateWrongs',$evaluateWrongs);
        $this->assign("week",$this->getWeekOfYear($now));
        $this->fetch();
    }

    /**
     * 推送警告
     */
    public function pushWrong(){
        //评价信息  本周内推送失败的
        $time = $this->getWeekStartTime(time());
        $evaLogWrongs=(new HlappEvaluateSendLogs())->getFalseLog(1,$time);
        //方案推送 失败的
        $solveLogWrongs = (new HlappEvaluateSendLogs())->getFalseLog(2,24*7);
        $this->assign("solveLogWrongs",$solveLogWrongs);
        $this->assign('evaLogWrongs',$evaLogWrongs);
        $this->fetch();
    }
}